import java.io.IOException;
import java.util.ArrayList;

import test.orwapkg.AnotherSampleClass;
/*
public class Y {
	String x = "hello";
	Y(String str){x = str;}
	
	public static void main(String[] args) throws IOException {
		
		
		new Y("orwa").print();
		try {
			doSomething();
		} catch (RuntimeException e) {
			System.out.println(e);
		}
	}

	static void doSomething() throws IOException {
		if (Math.random() > 0.5)
			throw new IOException();
		throw new RuntimeException();
	}
	
	public void print(){System.out.println(x);}
}

*/

public class Y extends x {
	Y() {
	}
	
	public int Y(){
		return 1;
	}

	private void two() {
		one();
	}
	
	@Override
	//when using @Override the program cannot use function hiding like (overload function in subclass) the method must use proper overloading
	//function must have must same signature of the function in super class (below commented example produce error)
	//public void three(int val){}
	public void three(String str){}
	
	void doWhatever(int i, int x, int y){}

	public static void main(String[] args) {
		ArrayList<Integer> list =  new ArrayList<>(1);
		list.add(1001);
		list.add(1002);
		System.out.println("list is:" + list.size());
		new Y().two();
		x xing = (x) new x();

		String msg1 = "Wham bam!";
		String msg2 = new String("Wham bam!");
		if (msg1 == msg2) {
			System.out.println("they match");
		}
		if (msg1.equals(msg2))
			System.out.println("they really match");

	
		
		int[] array = {1,2,3,4};
		System.arraycopy(array, 2, array, 0, 1);
		System.out.println(array[0]); 
		
		//new Y().doWhatever(1, 1); compilation fails with wrong number of arguments
		new Y().doWhatever(1, 1, 1);
		
		StringBuilder strb = new StringBuilder(128);
		System.out.println(strb.capacity());
		
		int per = 15 * 2 + 6;
		
		System.out.println(per);
		
		String color = "Red";
		switch(color){
		case "Red":
			System.out.println("found Red");
		case "Blue":
			System.out.println("found Blue");
		case "Black":
			System.out.println("found black");
		break;
		default:
			System.out.println("found nothing");
				
		}
		
	}
	
	{
		System.out.println("helloooo");
	}
	
}